package day14_junit_reflect_annotation_proxy.com.itheima.d1_junit;
import org.junit.*;
public class StringUtilTest {
    @Before
    public void before(){
        System.out.println("----before----");
    }
    @After
    public void after(){
        System.out.println("----after----");
    }
    @BeforeClass
    public static void beforeClass(){
        System.out.println("----beforeClass----");
    }
    @AfterClass
    public static void afterClass(){
        System.out.println("----afterClass----");
    }
    @Test
    public void testPrintNumber(){
        StringUtil.printNumber(null);
        StringUtil.printNumber("");
        StringUtil.printNumber("admin");
    }
    @Test
    public void testGetMaxIndex(){
        int i1 = StringUtil.getMaxIndex(null);
        Assert.assertEquals("null测试失败！", -1, i1);

        int i2 = StringUtil.getMaxIndex("");
        Assert.assertEquals("空字符串测试失败！", -1, i2);

        int i3 = StringUtil.getMaxIndex("admin");
        Assert.assertEquals("非空字符串测试失败！", 4, i3);

        System.out.println("测试结束！");

    }
}
